import request from '@/utils/request'

export function getCategoriesSelect() {
    return request({
        url: '/article/categories/getSelectLists',
        method: 'get'
    })
}

export function getList(params, get_url = false) {
    var url = `/articles`;
    if (get_url) return url;
    return request({
        url: url,
        method: 'get',
        params
    })
}

export function detail(id, get_url = false) {
    var url = `/article/detail`;
    if (get_url) return url;
    return request({
        url: url,
        method: 'get',
        params: { article_id:id }
    })
}

export function create(data, get_url = false) {
    var url = `/article/create`;
    if (get_url) return url;
    return request({
        url: url,
        method: 'post',
        data
    })
}

export function update(data, get_url = false) {
    var url = `/article/update`;
    if (get_url) return url;
    return request({
        url: url,
        method: 'put',
        data
    })
}

export function setDel(data, get_url = false) {
    var url = `/article/delete`;
    if (get_url) return url;
    return request({
        url: url,
        method: 'delete',
        data
    })
}

export function changeFiledStatus(data, get_url = false) {
    var url = `/article/changeFiledStatus`;
    if (get_url) return url;
    return request({
        url: url,
        method: 'put',
        data
    })
}
